package com.jdz.gxq.info.admin.economic.service;

import java.util.List;
import java.util.Map;

import jp.terasoluna.fw.dao.QueryDAO;
import jp.terasoluna.fw.dao.UpdateDAO;

import com.jdz.gxq.info.admin.economic.bo.Economic;

public class EconomicServiceImpl implements EconomicService {
	
	private QueryDAO queryDAO = null;
	
	private UpdateDAO updateDAO = null;
	
	/**
	 * Economic检索分页用，查询记录条数
	 * @return
	 */
	public int getEconomicsCount(String economicName) {
		
		int totalCount = queryDAO.executeForObject("economic.getEconomicsCount",
				economicName, Integer.class);
		
		return totalCount;
	}
	
	/**
	 * Economic检索
	 * @return
	 */
	public List<Economic> getEconomics(Map<String, Object> params) {
		
		return queryDAO.executeForObjectList("economic.getEconomics", params);
	}
	
	/**
	 * 追加Economic
	 * @param Economic
	 */
	public void insertEconomic(Economic economic) {
		
		updateDAO.execute("economic.insertEconomic", economic);
	}
	
	/**
	 * 更新Economic
	 * @param Economic
	 */
	public void updateEconomic(Economic economic) {
		
		updateDAO.execute("economic.updateEconomic", economic);
	}
	
	/**
	 * 通过id得到Economic
	 * @param id
	 * @return
	 */
	public Economic getEconomicById(int economicId) {

		Economic economic = queryDAO.executeForObject("economic.getEconomicById",
				economicId, Economic.class);
		
		return economic;
	}
	
	/**
	 * 删除Economic
	 * @param Economic
	 */
	public void deleteEconomic(int economicId) {
		
		updateDAO.execute("economic.deleteEconomicById", economicId);
	}

	public void setQueryDAO(QueryDAO queryDAO) {
		this.queryDAO = queryDAO;
	}

	public void setUpdateDAO(UpdateDAO updateDAO) {
		this.updateDAO = updateDAO;
	}
	
	
}
